﻿using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    /// <summary>
    /// 对应数据库中 obi_product 表（从截图看表名包含 obi_product ，按实际为准）的实体类
    /// </summary>
    public class BiProduct
    {
        /// <summary>
        /// 货品ID，对应数据库表中 goods_id 列
        /// </summary>
        [Key]
        public long GoodsId { get; set; }

        /// <summary>
        /// 货品编码，对应 goods_code 列
        /// </summary>
        public string GoodsCode { get; set; }

        /// <summary>
        /// 货品名称，对应 goods_name 列
        /// </summary>
        public string GoodsName { get; set; }
        /// <summary>
        /// 客户ID
        /// </summary>
        public long CustomerId { get; set; }
        /// <summary>
        /// 供应商ID
        /// </summary>
        public long SupplierId { get; set; }
        /// <summary>
        /// 货品类型ID，对应 goods_type_id 列
        /// </summary>
        public long GoodsTypeId { get; set; }

        /// <summary>
        /// 规格，对应 specification 列
        /// </summary>
        public string Specification { get; set; }

        /// <summary>
        /// 采购参考价，对应 purchase_reference_price 列
        /// </summary>
        public decimal PurchaseReferencePrice { get; set; }

        /// <summary>
        /// 销售参考价，对应 sales_reference_price 列
        /// </summary>
        public decimal SalesReferencePrice { get; set; }

        /// <summary>
        /// 显示顺序，对应 display_order 列
        /// </summary>
        public int DisplayOrder { get; set; }

        /// <summary>
        /// 状态，对应 status 列
        /// </summary>
        public string Status { get; set; }
        /// <summary>
        /// 是否预警（0=否，1=是）
        /// </summary>
        public string ShelfStatus { get; set; }
        /// <summary>
        /// 保质期（天），对应 shelf_life 列
        /// </summary>
        public int ShelfLife { get; set; }

        /// <summary>
        /// 保质期类型，对应 shelf_life_type 列
        /// </summary>
        public string ShelfLifeType { get; set; }

        /// <summary>
        /// 预警天数，对应 warning_days 列
        /// </summary>
        public int WarningDays { get; set; }

        /// <summary>
        /// 库存最小值，对应 stock_min 列
        /// </summary>
        public decimal StockMin { get; set; }

        /// <summary>
        /// 库存最大值，对应 stock_max 列
        /// </summary>
        public decimal StockMax { get; set; }

        /// <summary>
        /// 低于最小值数量，对应 below_min 列
        /// </summary>
        public decimal BelowMin { get; set; }

        /// <summary>
        /// 高于最大值数量，对应 above_max 列
        /// </summary>
        public decimal AboveMax { get; set; }

        /// <summary>
        /// 货品图片路径，对应 goods_image_path 列
        /// </summary>
        public string GoodsImagePath { get; set; }

        /// <summary>
        /// 附件ID，对应 attachment_id 列
        /// </summary>
        public long AttachmentId { get; set; }

        /// <summary>
        /// 是否删除，对应 is_delete 列
        /// </summary>
        public string IsDelete { get; set; }

        /// <summary>
        /// 创建人，对应 create_by 列
        /// </summary>
        public long CreateBy { get; set; }

        /// <summary>
        /// 创建时间，对应 create_time 列
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新人，对应 update_by 列
        /// </summary>
        public long UpdateBy { get; set; }

        /// <summary>
        /// 更新时间，对应 update_time 列
        /// </summary>
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 备注，对应 remarks 列
        /// </summary>
        public string Remarks { get; set; }
    }

    public class BiProductDTO
    {
        public long GoodsId { get; set; }
        public string GoodsCode { get; set; }
        public string GoodsName { get; set; }
        public long GoodsTypeId { get; set; }
        public string GoodsTypeName { get; set; }
        public string Specification { get; set; }
        public decimal PurchaseReferencePrice { get; set; }
        public decimal AvailableInventoryQty { get; set; }
    }
    public class BiProductDetailDTO
    {
        public long GoodsId
        { get; set; }
        public string GoodsCode
        { get; set; }
        public string GoodsName
        { get; set; }
        public string GoodsTypeName
        { get; set; }
        public string CustomerName
        { get; set; }
        public string SupplierName
        { get; set; }
        public string Specification
        { get; set; }
        public decimal PurchaseReferencePrice
        { get; set; }
        public decimal SalesReferencePrice
        { get; set; }
        public decimal DisplayOrder
        { get; set; }
        public string Status
        { get; set; }
        public string ShelfStatus
        { get; set; }
        public decimal ShelfLife
        { get; set; }
        public string ShelfLifeType
        { get; set; }
        public decimal WarningDays
        { get; set; }
        public decimal StockMin
        { get; set; }
        public decimal StockMax
        { get; set; }
        public decimal BelowMin
        { get; set; }
        public decimal AboveMax
        { get; set; }
        public string GoodsImagePath
        { get; set; }
        public long AttachmentId
        { get; set; }
        public string IsDelete
        { get; set; }
        public string CreateBy
        { get; set; }
        public DateTime? CreateTime
        { get; set; }
        public string UpdateBy
        { get; set; }
        public DateTime UpdateTime
        { get; set; }
        public string Remarks
        { get; set; }
        public decimal CurrentStock
        { get; set; }
    }
    // 添加所需的DTO类
    public class WarehouseWithLocationsDTO
    {
        public long WarehouseId { get; set; }
        public string WarehouseCode { get; set; }
        public string WarehouseName { get; set; }
        public string WarehouseAddress { get; set; }
        public decimal WarehouseCapacity { get; set; }
        public List<LocationDTO> Locations { get; set; }

    }

    public class LocationDTO
    {
        public long StorageLocationId { get; set; }
        public string StorageLocationCode { get; set; }
        public string storage_location_name { get; set; }
        public decimal storage_location_capacity { get; set; }
    }
    /// <summary>
    /// 仓库库存实体类
    /// </summary>
    public class WhInventoryDa
    {
        /// <summary>
        /// 库存ID（主键）
        /// </summary>
        public long InventoryId { get; set; }
        /// <summary>
        /// 批次ID
        /// </summary>
        public long BatchId { get; set; }

        /// <summary>
        /// 仓库ID（外键）
        /// </summary>
        public long WarehouseId { get; set; }
        /// <summary>
        /// 库位id
        /// </summary>
        public long StoraqeLocationId { get; set; }

        /// <summary>
        /// 货品ID，对应数据库表中 goods_id 列
        /// </summary>
        public long GoodsId { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 当前库存
        /// </summary>
        public decimal AvailableInventoryQty { get; set; }

        /// <summary>
        /// 计划出库数量
        /// </summary>
        public decimal TotalPlannedQuantity { get; set; }

        /// <summary>
        /// 仓库名称
        /// </summary>
        public string WarehouseName { get; set; }
        /// <summary>
        /// 仓库容量
        /// </summary>
        public decimal WarehouseCapacity { get; set; }
        /// <summary>
        /// 仓库编号
        /// </summary>
        public string WarehouseCode {  get; set; }
        /// <summary>
        /// 库位名称
        /// </summary>
        public string LocationName { get; set; }
        /// <summary>
        /// 库位编号
        /// </summary>
        public string LocationCode { get; set; }
        /// <summary>
        /// 库位容量
        /// </summary>
        public decimal StorageLocationCapacity {  get; set; }
    }
}
